package com.example.swing.jframe1;

import javax.swing.*;
import java.awt.*;
import java.util.concurrent.TimeUnit;

/**
 * 增加一个时间执行队列
 */
public class JFrameTestTask2 {
    public static void main(String[] args) throws InterruptedException {
        JFrame frame = new JFrame("Hello Swing");
        JButton button = new JButton("A Button");
        button.setSize(100, 50);
        frame.add(button);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(500,300);
        frame.setVisible(true);
        TimeUnit.SECONDS.sleep(3);
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                button.setText("button is change");
            }
        });
        button.setText("button is change");
    }
}
